package com.example.bes952.springboot2.bcs.producer;

import lombok.AllArgsConstructor;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@Component
@AllArgsConstructor
public class CycleGeneratorStreamMessageRunner {
    
    private final StreamProducer streamProducer;

    public void sent() {
        streamProducer.sendRecord("stream-001");
    }
    
    /*@Override
    public void run(ApplicationArguments args) {
        Executors.newSingleThreadScheduledExecutor()
                .scheduleAtFixedRate(() -> streamProducer.sendRecord("stream-001"),
                        0, 30, TimeUnit.SECONDS);
    }*/
}